function shake( obj, attr, endFn ){
	if ( obj.finished ) {
		return;
	};
	obj.finished = true;			//解决隐患

	var arr = [];
	var num = 0;
	var pos = parseInt(getStyle( obj, attr ));		//有隐患

	for (var i=20;i>0;i-=2){
		arr.push(i,-i)
	}
	arr.push(0);

	clearInterval( obj.timer );
	obj.timer = setInterval(function(){
		obj.style[attr] = pos + arr[num] + 'px';
		num ++;
		if (num === arr.length) {
			clearInterval( obj.timer );
			obj.finished = false;
			endFn && endFn();
		};
	},50)
}

function getStyle( obj, attr ){
	return obj.currentStyle ? obj.currentStyle[attr] : getComputedStyle(obj)[attr];
}